import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
// import { MyLogger } from './sysModules/logger';
import { Logger } from '@nestjs/common';

async function bootstrap() {
  const logger = new Logger('Bootstrap');
  const app = await NestFactory.create(AppModule);
  // app.useLogger(new MyLogger());
  await app.listen(process.env.PORT ?? 3000);

  // 监听关闭信号
  process.on('SIGTERM', async () => {
    logger.log('SIGTERM signal received');
    await app.close();
  });
  
  process.on('SIGINT', async () => {
    logger.log('SIGINT signal received');
    await app.close();
  });
}
bootstrap();
